package com.lancoo.ccas53.service.impl;

import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lancoo.ccas53.entity.Type;
import com.lancoo.ccas53.mapper.TypeMapper;
import com.lancoo.ccas53.service.TypeService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 类型/标签表 服务实现类
 * </p>
 *
 * @author quin.song
 * @since 2024-05-20
 */
@Service
public class TypeServiceImpl extends ServiceImpl<TypeMapper, Type> implements TypeService {

    @Override
    public List<Type> getType(Integer taskId, Integer typeMode) {
        List<Type> typeList = this.lambdaQuery().eq(Type::getTaskId, taskId).eq(Type::getTypeMode, typeMode).list();
//        if (typeMode.equals(1) && CollUtil.isEmpty(typeList)) {
//            //如果不存在任何教学活动，则初始化一些默认的活动
//            Type type = new Type();
//            type.setTypeMode(1).setTypeName("军训").setFlag(1).setTaskId(taskId).setIcon(1);
//            this.save(type);
//
//            Type type1 = new Type();
//            type1.setTypeMode(1).setTypeName("实习").setFlag(1).setTaskId(taskId).setIcon(2);
//            this.save(type1);
//        }
        return typeList;
    }
}
